package com.ruoyi.web.controller.doulai;

import java.util.List;

import com.ruoyi.system.domain.Discount;
import com.ruoyi.system.service.IDiscountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.ExcelUtil;

/**
 * 折扣 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-01-06
 */
@Controller
@RequestMapping("/doulai/discount")
public class DiscountController extends BaseController
{
    private String prefix = "doulai/discount";
	
	@Autowired
	private IDiscountService discountService;

	@GetMapping()
	public String discount()
	{
	   return  "/pages/discount/discount";
	}
	
	/**
	 * 查询代理玩家折扣列表
	 */
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Discount discount)
	{
		startPage();
        List<Discount> list = discountService.selectDiscountList(discount);
		return getDataTable(list);
	}
	
	/**
	 * 修改保存折扣
	 */
	@Log(title = "折扣", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	@Transactional
	public AjaxResult editSave(Discount discount)
	{		
		return toAjax(discountService.updateDiscount(discount));
	}

	
}
